package com.coolzeng.service.impl;

import com.coolzeng.dao.PostMapper;
import com.coolzeng.entity.Post;
import com.coolzeng.service.PostService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/6/9.
 */
@Service
public class PostServiceImpl implements PostService{

    @Autowired
    private PostMapper postMapper;

    @Override
    public Post Getpost(int id) {
        return postMapper.selectByPrimaryKey(id);
    }
//查找所有帖子
    @Override
    public List<Post> selectAllPost() {

        return  postMapper.selectAllPost();
    }


    //返回post数量
    @Override
    public int getPostCount() {
        return postMapper.selectpostCount();
    }

    //新建帖子
    @Override
    public Void instrt(Post newpost) {
        postMapper.insert(newpost);
        return null;
    }
}
